﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BattleTech.Models;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{
			var x = System.Xml.Linq.XElement.Load("Introductory.BattleTech-Catalog");
			var catalog = new Catalog(x);

			foreach (var mech in catalog.Mechs)
			{
				Console.WriteLine(mech.Name + " " + mech.Callsign);
				Console.WriteLine("Weapons");
				foreach (var item in mech.Equipment.Where(e => e.Equipment is WeaponDefinition))
					Console.WriteLine(String.Format("\t{0} {1}", item.Equipment.Name, item.Location));
				Console.WriteLine("Ammo");
				foreach (var item in mech.Equipment.Where(e => e.Equipment is AmmoDefinition))
					Console.WriteLine(String.Format("\t{0} {1} ({2} shots)", item.Equipment.Name, item.Location, ((AmmoDefinition)item.Equipment).Shots * item.Quantity));
			}
		}
	}
}
